home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / More Source / C⁄C++ / Arashi 1.1 / Game Source / mtz / mtz src / count.c next >
Encoding:
C/C++ Source or Header  |  1993-02-07  |  3.6 KB  |  96 lines  |  [TEXT/KAHL]

  1. /* This routine sums the scores fro the LEVL rsrc included in the ARS.rsrc file */
  2. /* Simply put, there is only a probability of how many points a player might score */
  3. /* How many Spikers, and Plasma shots will be scored by the player is perhaps */
  4. /* the largest variable.  Also, the player does not receive points for enemies */
  5. /* onEdge at Flythru.  Further at higher levels, the player may tend to one spot */
  6. /* and will not hit more Spikers even if more are appearing.  This is all only */
  7. /* a guess, legitimized by scores from sample games. */
  8.  
  9. /* This routine will also store the new lvStBonus scores in the LEVEL resource which */
  10. /* can then be pasted into a new ARASHI file. */
  11.  
  12. /* December 16, 1992  Mike Zimmerman */
  13.  
  14. #include "STORM.h"
  15. #include <stdio.h>
  16.  
  17. #define probOfHittingSpkr 0.40
  18. #define    predNumber    20
  19.  
  20. main()
  21. {
  22.     LevelInfo    **LInfo;
  23.     int            i;
  24.     long        int levelbonus=0;
  25.     long        int totalbonus=0;
  26.     FILE        *fp;
  27.     int            predNumSpkrs=0;
  28.     long        int    oldBonus=0;
  29.     
  30.     /* fp=fopen("scores","w"); */
  31.     
  32.     for(i=1;i <= 96 ;i++)
  33.     {    LInfo=(void *)GetResource('LEVL',(127+i));
  34.     HNoPurge(LInfo);
  35.     /* fprintf(fp,"LEVEL %d \n",i); */
  36. #ifdef BONUSGEN
  37.     predNumSpkrs=0;
  38.     if ((*LInfo)->spProb)
  39.         predNumSpkrs = (int)((i * .45));
  40.     if (predNumSpkrs > 12)
  41.         predNumSpkrs = 12 + (int)(i * .08);
  42.     /* fprintf(fp,"spProb was %d \n",(*LInfo)->spProb);
  43.     fprintf(fp,"Predicted number of Spikers %d \n",predNumSpkrs); */
  44.     levelbonus =  (long)(*LInfo)->flPoints*(*LInfo)->flCount + 
  45.             (long)(*LInfo)->puPoints*(*LInfo)->puCount + 
  46.             (long)(*LInfo)->fuBullseye*(*LInfo)->fuCount + 
  47.             (long)(300 + ((*LInfo)->tk[0].points) )*(*LInfo)->tk[0].count + 
  48.             (long)(1000 + ((*LInfo)->tk[1].points) )*(*LInfo)->tk[1].count + 
  49.             (long)(400 + ((*LInfo)->tk[2].points) )*(*LInfo)->tk[2].count +
  50.             (long)(*LInfo)->lvBonus +
  51.             (long)( (*LInfo)->spPoints * predNumSpkrs) +
  52.             (long)( (*LInfo)->spPlPoints * predNumSpkrs * (*LInfo)->spPlasma * .35);
  53.     
  54.     /* fprintf(fp,"%d Flippers at %d points each = %ld \n",(*LInfo)->flCount,
  55.         (*LInfo)->flPoints,    (long)(*LInfo)->flPoints*(*LInfo)->flCount);
  56.     fprintf(fp,"%d Pulsars at %d points each = %ld \n",(*LInfo)->puCount,
  57.         (*LInfo)->puPoints,(long)(*LInfo)->puPoints*(*LInfo)->puCount);
  58.     fprintf(fp,"%d Fireballs at %d points each = %ld \n",(*LInfo)->fuCount,
  59.         (*LInfo)->fuBullseye,(long)(*LInfo)->fuBullseye*(*LInfo)->fuCount);
  60.     fprintf(fp,"%d fltankers at %d points each = %ld \n",(*LInfo)->tk[0].count,
  61.         (*LInfo)->tk[0].points,(long)(300+(*LInfo)->tk[0].points)*(*LInfo)->tk[0].count);
  62.     fprintf(fp,"%d putankers at %d points each = %ld \n",(*LInfo)->tk[1].count,
  63.         (*LInfo)->tk[1].points,(long)(400+(*LInfo)->tk[1].points)*(*LInfo)->tk[1].count);
  64.     fprintf(fp,"%d futankers at %d points each = %ld \n",(*LInfo)->tk[2].count,
  65.         (*LInfo)->tk[2].points,(long)(400+(*LInfo)->tk[2].points)*(*LInfo)->tk[2].count);
  66.     fprintf(fp,"Predicted point for Spikers = %ld \n",
  67.         (long)( (*LInfo)->spPoints * predNumSpkrs));
  68.     fprintf(fp,"Predicted points for Plasma = %ld \n",
  69.         (long)( (*LInfo)->spPlPoints * predNumSpkrs * (*LInfo)->spPlasma * .35));
  70.     fprintf(fp,"So the total for level %d is %ld \n",i,levelbonus); */
  71.     
  72.     (*LInfo)->lvStBonus = oldBonus;
  73. #endif
  74.     (*LInfo)->shPower = 5;
  75.     ChangedResource(LInfo);
  76.     WriteResource(LInfo);
  77.     HPurge(LInfo);
  78. #ifdef BONUSGEN    
  79.     ReleaseResource(LInfo);
  80.     totalbonus += levelbonus;
  81.     oldBonus = (long)(1.10*totalbonus);
  82.     oldBonus = oldBonus/10;
  83.     oldBonus = oldBonus*10;
  84.  
  85.     /* fprintf(fp,"Total going into level %d is %ld \n", i+1, totalbonus); */
  86.     /*    fprintf(fp,"So the starting bonus for level %d is %ld \n",(i+1),(long)(totalbonus*.95));
  87.     fprintf(fp,"=========================== \n");
  88. #endif
  89.     }
  90. #ifdef BONUSGEN
  91.     fclose(fp); */
  92. #endif
  93.     }
  94. }
  95.  
  96.